	function WSStartWork(){
		ws.onmessage = function(evt) {     

		//	alert(evt.data);
			
			var data = JSON.parse(evt.data);
			
		
			MYWEBSOCKETMETHOD[data.flag](data.status,data.backvalue);
			
		};  

		ws.onclose = function() {   
			alert('close~~~~~~~');  
		};  

		ws.onopen = function() {     
			alert('open~~~~~~~~');   
		};  
	}
	
	MYWEBSOCKETDATA={
		contacts:{},
		chartRooms:{}
	}
	
	MYWEBSOCKETMETHOD={
		$client_login:function(status,backvalue){},
		$client_enterRoom:function(status,backvalue){},
		$client_room_user_in:function(status,backvalue){},
		$client_room_user_out:function(status,backvalue){},
		$client_room_chat:function(status,backvalue){}
	}

<!-- -->

	MYWEBSOCKETMETHOD.$client_login = function(status,backvalue){
	//	alert(backvalue);
			if(status == 'success'){

					MYWEBSOCKETDATA.contacts = backvalue.contacts;
					MYWEBSOCKETDATA.chartRooms = backvalue.chatRooms
			// js for contactPanel
				contacts_paint();
			
			// js for chatRoomPanel
				chatRoomList_paint();
			
			
			//end
				pageIndex = 0;
				gotoTargetPage();
			
			
				initMenu();
				mobileTouchEvent();
		
		
				$('#gotoContactsPageLink').click();
			
		
				
				
				initContentSize();
				
				chatRoomList_paint_brow(60);
			
			}else{
				alert(status);	
			}
		}
		
		
	MYWEBSOCKETMETHOD.$client_enterRoom =	function(status,backvalue){
			if(status == 'success'){
				chatRoomInfo = backvalue;
				chatRoomList_enterRoom();
			}else{
				alert(status);	
			}
	}
	
	MYWEBSOCKETMETHOD.$client_room_user_in=	function(status,backvalue){
		chatRoom_user_in(backvalue);
	}
	
	MYWEBSOCKETMETHOD.$client_room_user_out= function(status,backvalue){
		chatRoom_user_out(backvalue);
	}
	MYWEBSOCKETMETHOD.$client_room_chat= function(status,backvalue){
		chatRoom_receiveMessage(status,backvalue);
	}